package com.wjq.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.wjq.entity.Questionnaire;
import com.wjq.entity.Result;
import com.wjq.service.ResultService;
import org.apache.ibatis.javassist.NotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
public class ResultController {

    @Autowired
    ResultService resultService;

    @GetMapping("/returnAnswer/{questionnaireId}/{fillId}")
    public List<Result> returnAnswer(@PathVariable("questionnaireId") Integer questionnaireId,@PathVariable("fillId") Integer fillId){
        List<Result> answer = resultService.getAnswer(questionnaireId, fillId);
        answer.forEach(System.out::println);
        return answer;
    }


}
